﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using t01crm.Data;

namespace t01crm.Business
{
    public class ListGenerator // <T> where T: IComparable 
    {
        

        //public static List<T> GetList( T min, T increment, T max)
        //{
        //    List<T> ret = new List<T>();  
            
        //    //T  current; 
        //    //for ( ; current < max ; current += increment ) 
        //    //{ 
        //    //    ret.Add (   current ); 
        //    //}
        //    return ret;  

        //}

        public static List<int> GetIntList(int min, int increment, int max)
        {
            List<int> ret = new List<int>();
            for (; min < max; min += increment)
            {
                ret.Add(min); 
            }
            return ret; 
        }

        public static List<double> GetDoubleList(double min, double increment, double max)
        {
            List<double> ret = new List<double>();
            for (; min < max; min += increment)
            {
                ret.Add(min);
            }
            return ret;
        }
    }

    

    public class FilterMetadata : DataEntity 
    {
        internal FilterMetadata()
        {

        }

        private static FilterMetadata _instance; 

        public static FilterMetadata Current
        {
            get 
            {
                if (_instance == null)
                {
                    _instance = new FilterMetadata();
                }
                return _instance; 
            }     
        }

        public static List<double> Prices
        {
            get
            {
                return ListGenerator.GetDoubleList(150000, 50000, 1000000); 
            } 
        }
        public static List<int> Rooms 
        {
            
            get
            {
                return ListGenerator.GetIntList(0, 1, 8); 
            }
        }

        public static List<double> BathRooms
        {

            get
            {
                return ListGenerator.GetDoubleList(0, .5, 6 );
            }
        }


        public static List<int> Garage
        {
            get
            {
                return ListGenerator.GetIntList(0, 1, 6);
            }
        }

        public static System.Collections.IList PropertyTypes
        {
            get
            {
                return Enum.GetValues ( typeof(t01crm.Data.PropertyType)) ; 
            } 
        }

        public static List<double> SquareFootage
        {
            get
            {
                return ListGenerator.GetDoubleList( 800, 400, 8000);
            }
        }

        public static List<double> Acreage
        {
            get
            {
                return ListGenerator.GetDoubleList(1000, 500, 10000);
            }
        }

        public static List<int> PropertyAge
        {
            get
            {
                return ListGenerator.GetIntList( 1900, 10, 2010);
            }
        } 
    }
}
